package com.vms.control.weight.adapters;

import com.vms.control.weight.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

/**
 * Created by Sinner on 26.01.14.
 */
public class Days30Adapter extends BaseAdapter {

    private Context mContext;

	public Days30Adapter(Context context){
        super();
        this.mContext = context;
    }

    @Override
    public boolean areAllItemsEnabled() {
        return true;
    }

    @Override
    public boolean isEnabled(int position) {
        return true;
    }

    @Override
    public int getCount() {
        return 28;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

     class HolderItem {
    	
    	public View mOneDayLayout;
    	public TextView mFirstDesc;
    	public TextView mFirstValue;
    	public TextView mSecondDesc;
    	public TextView mSecondValue;

		public HolderItem (){
    		LayoutInflater inflater = LayoutInflater.from(mContext);
        	mOneDayLayout = inflater.inflate(R.layout.one_day_grid_item,null);
        	mFirstDesc = (TextView) mOneDayLayout.findViewById(R.id.first_description);
        	mFirstValue = (TextView) mOneDayLayout.findViewById(R.id.first_value);
        	mSecondDesc = (TextView) mOneDayLayout.findViewById(R.id.second_description);
        	mSecondValue = (TextView) mOneDayLayout.findViewById(R.id.second_value);
    	}
    }
    
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
    	HolderItem holderItem = (HolderItem) (convertView == null? new HolderItem() : convertView.getTag());
    	holderItem.mOneDayLayout.setTag(holderItem);
    	
    	holderItem.mFirstDesc.setText("first-"+position);
    	holderItem.mFirstValue.setText(":"+position);
    	holderItem.mSecondDesc.setText("second-"+position);
    	holderItem.mSecondValue.setText(":"+position);
    	
    	return holderItem.mOneDayLayout;
    }
}
